package com.totoro.mybatis.mul_datasource_dynamic.service.school;

import com.totoro.mybatis.mul_datasource_dynamic.aop.DS;
import com.totoro.mybatis.mul_datasource_dynamic.dao.school.SchoolDao;
import com.totoro.mybatis.mul_datasource_dynamic.domain.school.School;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Niki on 2018/8/16 10:03
 */
@Service
public class SchoolService {
    @Autowired
    SchoolDao schoolDao;

    @DS("db2")
    public int insertSchool(School school) {
        schoolDao.insertSchool(school);
        return school.getId();
    }

    @DS("db2")
    public School queryById(int id) {
        return schoolDao.queryById(id);
    }
}
